package org.hdax.dm.rest.service;

import org.hdax.dm.dao.entitydao.DmOrderDao;
import org.hdax.dm.entity.order.DmOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RestDmOrderService {

    @Autowired
    private DmOrderDao dmOrderDao;

    @PostMapping(path = "/addOrder")
    public DmOrder addOrder(@RequestBody DmOrder dmOrder){
        return dmOrderDao.save(dmOrder);
    }


    @PostMapping(path = "/delOrder")
    public void delOrder(@RequestParam("orderNo") String orderNo){
        dmOrderDao.deleteByOrderNo(orderNo);
    }

}
